package com.artPreter.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 大屏警报信息表
 * </p>
 *
 * @author Jarvis_He
 * @since 2024-04-24
 */
@Getter
@Setter
@TableName("jv_alert_message")
public class AlertMessage implements Serializable {

    private static final long serialVersionUID = 1L;



    //创建时间")
    @TableField("create_time")
    private Long createTime;

    //排序")
    @TableField("sort")
    private Integer sort;

    //备注")
    @TableField("remarks")
    private String remarks;

    //标准值")
    @TableField("standard")
    private Double standard;

    //测定值")
    @TableField("value")
    private Double value;

    //是否警报")
    @TableField("is_over")
    private Integer isOver;

    //区域id")
    @TableField("position")
    private String position;

    //楼层id")
    @TableField("floor")
    private String floor;

    //房间id")
    @TableField("room")
    private String room;

    //报警设备uuid")
    @TableField("device_id")
    private String deviceId;

    //库房名称")
    @TableField("room_name")
    private String roomName;

    //楼层名称")
    @TableField("floor_name")
    private String floorName;

    //区域名称")
    @TableField("posi_name")
    private String posiName;

    //警报信息")
    @TableField("msg")
    private String msg;

    //1:温度 2:湿度 3:漏水 4:烟感")
    @TableField("type")
    private Integer type;

    //预计关闭警报时间")
    @TableField("plan_cd_time")
    private Long planCdTime;

    //实际关闭警报时间")
    @TableField("cd_time")
    private Long cdTime;

    @TableField(exist = false)
    private Long startTime;

    @TableField(exist = false)
    private Long endTime;

    public AlertMessage() {
    }

    public AlertMessage(AlertMessage item) {
        this.sort = item.getSort();

        this.remarks=item.getRemarks();

        this.standard = item.getStandard();

        this.value = item.getValue();

        this.isOver = item.getIsOver();

        this.position = item.getPosition();

        this.floor = item.getFloor();

        this.room = item.getRoom();

        this.deviceId = item.getDeviceId();

        this.roomName = item.getRoomName();

        this.floorName = item.getFloorName();

        this.posiName = item.getPosiName();

        this.msg = item.getMsg();

        this.type = item.getType();

        this.planCdTime = item.getPlanCdTime();

        this.cdTime = item.getCdTime();

        Long timeLong = System.currentTimeMillis() / 1000;
        this.createTime = timeLong;
    }

    public AlertMessage(AlertMemo alertMemo) {

        this.remarks= alertMemo.getRemarks();

        this.standard = 0.0;

        this.value = 0.0;

        this.isOver = 1;

        this.position = alertMemo.getPosition();

        this.floor = alertMemo.getFloor();

        this.room = alertMemo.getRoom();

        this.deviceId = alertMemo.getDeviceId();

        this.roomName = alertMemo.getRoomName();

        this.floorName = alertMemo.getFloorName();

        this.posiName = alertMemo.getPosiName();

        this.msg = alertMemo.getRemarks()+ alertMemo.getMsg();

        if(alertMemo.getMsg().equals("漏水警报")){
            this.type = 3;
        }else {
            this.type = 4;
        }

        Long timeLong = System.currentTimeMillis() / 1000;
        this.planCdTime = timeLong + 300;
        this.createTime = timeLong;
    }
}
